package lc.动态规划;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/19
 */
public class 剑指Offer10I_斐波那契数列 {

    public int fib(int n) {
        if (n == 0 || n == 1) return n;
        int pre = 0;
        int j = 1;
        int num = 0;
        for (int i = 2; i <= n; i++) {
            num = pre + j;
            pre = j;
            j = num  % 1000000007;
        }
        return j;
    }
}
